package com.redteam.util;

/**
 * Utility Class to convert the date format.
 * @author Teddy Karam
 */
public class DateConverter {

    /**
     * Convert from mm/dd/yyyy to yyyy-mm-dd
     * @param date
     * @return newDate
     */
    public static String convertDate(String date) {
        String[] result = date.split("/");
        String newDate = result[2] + "-" + result[0] + "-" + result[1];
        return newDate;
    }

    public static String convertDateSqlToRegular(String date) {
        String[] result = date.split("-");
        String newDate = result[1] + "/" + result[2] + "/" + result[0];
        return newDate;
    }
}
